<?php
/**
 * Created by PhpStorm.
 * User: Monkey
 * Date: 2021/10/13
 * Time: 11:27
 * Desc: 工具
 */
declare (strict_types=1);

namespace app\backend\controller;

use app\backend\base\controller\Base;
use think\facade\Filesystem;

class Tool extends Base
{
    /**
     * 上传
     */
    public function upload()
    {
        if(request()->isPost()){
            $file = request()->file('file');
            $path = input('path');

            // 上传到本地服务器
            $saveName = Filesystem::disk('public')->putFile($path, $file);

            return json(_S('上传成功','/storage/'.$saveName));
        }
    }
}
